GtkThemingEngine: Be a bit more robust against missing essential properties.
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 3 Dec 2010 11:25:12 +0000 (12:25 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:39:57 +0000 (15:39 +0100)
gtk/gtkthemingengine.c

index 7469aefc6e8666d55e01fa04ffa3505430a95e03..2b9c4ce8dcb2dc9a787d26afe5023d534f2cb028 100644 (file)
@@ -2278,12 +2278,16 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
                               "color", &other_fg,
                               NULL);
 
-      fg_color->red = CLAMP (fg_color->red + ((other_fg->red - fg_color->red) * progress), 0, 1);
-      fg_color->green = CLAMP (fg_color->green + ((other_fg->green - fg_color->green) * progress), 0, 1);
-      fg_color->blue = CLAMP (fg_color->blue + ((other_fg->blue - fg_color->blue) * progress), 0, 1);
-      fg_color->alpha = CLAMP (fg_color->alpha + ((other_fg->alpha - fg_color->alpha) * progress), 0, 1);
+      if (fg_color && other_fg)
+        {
+          fg_color->red = CLAMP (fg_color->red + ((other_fg->red - fg_color->red) * progress), 0, 1);
+          fg_color->green = CLAMP (fg_color->green + ((other_fg->green - fg_color->green) * progress), 0, 1);
+          fg_color->blue = CLAMP (fg_color->blue + ((other_fg->blue - fg_color->blue) * progress), 0, 1);
+          fg_color->alpha = CLAMP (fg_color->alpha + ((other_fg->alpha - fg_color->alpha) * progress), 0, 1);
+        }
 
-      gdk_rgba_free (other_fg);
+      if (other_fg)
+        gdk_rgba_free (other_fg);
     }
 
   if (matrix)